<template>
	<view>
		<flowtool :outid="storeChangeInfo.Id" :flowid="flowId" :deptid="deptId" :outshowbutton="storeChangeInfo.Status == '未审核' ? true : false " :dataname="storeChangeInfo.ChangeType" :formstate="storeChangeInfo"></flowtool>
		<u-image :src="changeImg" width="100vw" height="100%" mode="widthFix" @click="imgPreview(changeImg)"></u-image>
		<fileview :outid="storeChangeId"></fileview>
	</view>
</template>

<script>
	import {
		baseUrl,
	} from '@/common/config.js'
	import flowtool from "../c_flowtool.vue"
	import fileview from "../c_fileview.vue"
	import {
		getstoreinfo
	} from '@/common/api.js'
	export default {
		components: {
		  flowtool,
		  fileview
		},
		data() {
			return {
				storeChangeId: "",
				changeImg: "",
				storeChangeInfo: {},
				flowId: "",
				deptId: "",
			}
		},
		onLoad(options) {
			this.user = JSON.parse(uni.getStorageSync("$userinfo"))
			this.storeChangeId = options.storeChangeId
			this.flowId = options.flowId	
		},
		onShow() {
			let para = {
				Parameters: [{
					FieldName: "Id",
					ConditionalType: "Equal",
					FieldValue: this.storeChangeId
				}],
				pageIndex: 1,
				pageSize: 20,
				orderBys: ["CreateTime desc"],
			}
			getstoreinfo(para).then(res =>{
				this.storeChangeInfo = res.data[0]
				if(res.data[0].InStore){
					this.deptId = res.data[0].InStore.DeptId
				}else{
					this.deptId = res.data[0].OutStore.DeptId
				}
			})
			this.changeImg = "https://project.gxrunxiang.com/SysFile/viewstore?id=" + this.storeChangeId
		},
		onReady() {
				
		},
		methods: {
			tocode(){
				wx.scanCode({
					onlyFromCamera: true,
					success (res) {
					    console.log(res)
					  },
					  fail(res){
						  console.log(res);
					  }
				})
			},
			imgPreview(url) {
			    uni.previewImage({
			        urls: [url]
			    })
			},

		}
	}
</script>

<style>

</style>